
{extend name='public/window' /}

{block name="content"}

<div class="layui-fluid">
    <div class="layui-card">

        <div class="layui-card-body" style="padding: 15px;">
            <form class="layui-form" action="" lay-filter="form">
            <div class="layui-tab layui-tab-brief">
                <ul class="layui-tab-title">
                    <li class="layui-this">参数设置</li>
                    
                </ul>
                <div class="layui-tab-content" style="margin-top: 20px;">

                    <div class="layui-tab-item layui-show">
                        
                        <div class="layui-form-item">
                            <label class="layui-form-label">栏目：</label>
                            <div class="layui-input-block">
                                <select name="cate_id" lay-verify="required" >
                                    <option value="0">请选择</option>
                                    {$cate|make_option='','title_show','id'}
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">起始ID：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="text" name="startid" class="layui-input ">
                            </div>

                            <label class="layui-form-label">结束ID：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="text" name="endid" value="" class="layui-input ">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">字段：</label>
                            <div class="layui-input-block">
                                <input type="checkbox" name="flds[gongjiao]" title="公交" checked=""><div class="layui-unselect layui-form-checkbox layui-form-checked"><span>公交</span><i class="layui-icon layui-icon-ok"></i></div>
                                <input type="checkbox" name="flds[ditie]" title="地铁" checked=""><div class="layui-unselect layui-form-checkbox layui-form-checked"><span>地铁</span><i class="layui-icon layui-icon-ok"></i></div>
                                <input type="checkbox" name="flds[tingche]" title="停车场" checked=""><div class="layui-unselect layui-form-checkbox layui-form-checked"><span>停车场</span><i class="layui-icon layui-icon-ok"></i></div>
                                <input type="checkbox" name="flds[canting]" title="餐厅" checked=""><div class="layui-unselect layui-form-checkbox layui-form-checked"><span>餐厅</span><i class="layui-icon layui-icon-ok"></i></div>
                                <input type="checkbox" name="flds[jiudian]" title="酒店" checked=""><div class="layui-unselect layui-form-checkbox layui-form-checked"><span>酒店</span><i class="layui-icon layui-icon-ok"></i></div>
                                <br/>

                                <input type="checkbox" name="flds[jieshao]" title="介绍" checked=""><div class="layui-unselect layui-form-checkbox layui-form-checked"><span>介绍</span><i class="layui-icon layui-icon-ok"></i></div>
                                <input type="checkbox" name="flds[litpic]]" title="图片" checked=""><div class="layui-unselect layui-form-checkbox layui-form-checked"><span>图片</span><i class="layui-icon layui-icon-ok"></i></div>
                                <input type="checkbox" name="flds[first]]" title="首字母" checked=""><div class="layui-unselect layui-form-checkbox layui-form-checked"><span>首字母</span><i class="layui-icon layui-icon-ok"></i></div>
                                <br/>
                            </div>
                          </div>

                          <div class="layui-form-item">
                            <label class="layui-form-label">重新生成：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="radio" name="again" value="1" title="是" lay-filter="" >
                                <input type="radio" name="again" value="0" title="否" lay-filter=""  checked>
                            </div>

                            <label class="layui-form-label">单次数量：</label>
                            <div class="layui-input-inline input-custom-width">
                                <input type="text" name="num" value="10" class="layui-input ">
                            </div>
                        </div>

                        <!-- <div class="layui-form-mid layui-word-aux"></div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">信息：</label>
                            <div class="layui-input-block input-custom-width">
                                <textarea class="layui-textarea"></textarea>
                            </div>
                        </div> -->

                    </div>

                    

                </div>

            </div>
                <div class="layui-form-item layui-layout-admin " style="width: 100%">
                    <div class="layui-input-block">
                        <div class="layui-footer" style="left: 0px;text-align: center;">
                            <button class="layui-btn" lay-submit="" lay-filter="exe">执行</button>
                            <button type="reset" class="layui-btn layui-btn-primary">{:__('Reset')}</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script>
    layui.use(['element', 'form', 'jquery','lucky'], function () {
        var element = layui.element;
        var table = layui.table;
        var form = layui.form;
        var $ = layui.jquery;
        var lucky=layui.lucky;

        form.on('submit(exe)', function (data) {
            layer.msg('正在执行。。', { icon: 1, time: 0, shade: 0.3, anim: 4 });
            Execute("{:url('make')}",data.field);
            return false;
        });

    })

    function Execute(url, data){
        $.post(url,data,function(res){
            layer.msg(res.msg, { icon: 1, time: 0, shade: 0.3, anim: 4 });
            if(res.code == 1){
                data.startid = res.data.id;
                Execute(url,data);
            }else{
                layer.msg(res.msg, { icon: 1, time: 1500, shade: 0.3, anim: 4 });
                console.log(res);
            }
        });
    }
    
</script>

{/block}

